Fixed a null pointer error.