fixing nullpointerexception