fixed NullPointerException bug found in class