fixed scanner branching
passing test suite