Fix nullpointer error