fixed NPE bug