fix NPE in new code