fix when()