Fix when_ deprecation warning - update conditionals to use new syntax