Fixing the problem with "when" kwargs