Fix nullPointerException issue