fix a null pointer error