fixing and improving securityconfig.java