More careful testing of scratching, and correctly handle the case