Fix nullpointer problem