fix a null pointer exception