Correct wrong double-when behaviour