Fix nullpointer exception.