r427: fixed bugs in backtrack

See comments in ksw_global() for details.