avoiding a null pointer exception