Wraps variables inside `when` for macosx. Refs #461.