fixed nullpointerexceptions