Fixed issue writting security configuration repeatedly to the end of the
config file