nullpointer exception fix - attempt 1