Fix #4497

This adds a fallback to prevent the env from being missed