fix bug in scan state