Fix nullpointer access