authenticate nullpointer exception fix