Adding a type check for the values passed to Environment.set.