KT-4008 'Replace if with when' is available but does not work