added nullpointer guard