fix(scanner) fix various scanning bugs