Handle nullpointerexception