Fixed a null pointer exception error