fix issue KT-5234 and KT-5058: 'when' statement in 'for', 'while' ...

The title says it all.