properly join ref environments