fixed the null pointer error.