Added checks if priv pointer is not NULL