Added the "Maintenance mode" check to a $app-error. Fixes #664.