guarding against non-string keys and values from get_environment
adding set_default_environment which defaults to using get_environment()