Fix exception when application.mode is something else then DEV or PROD

Fixes [#1593]