Fix nullpointerexception