Fixed a null pointer exception