fixed nullpointer in code