fix NPE bug