bugfix for environement remove when page is closed