switch flag checked first
debug