adding nullpointer guard