Fix null pointer error.