Fixes .when attribute
Adds backward compability and tests
More explicity testing of 'where' parameter