- fix npe
- add scan states