Checking environment for view promotion. Fixes #2089