Fix nullpointer bug.