Moved application setting code above security check