Fixed null pointer error