fix NPE and message