some nullpointer checks