fix calling context bug in `when()`