Fix mistaken if->when change