Fix NullPointerException error