Fixed null pointer error.