fixes #8438 - using correct environments for repository lookup