fixed null pointer error