Fix nullpointer case