fix when conditions