null pointer exception fixes