fix NPE and TODO list