fixed a null pointer exception