fixed null pointer error.