NPE bug fixed