Minor fix for accessing the app in environments

When accessing the `environment._application` the handlers where added
every time. This is now fixed.