fix error for null pointer