Fixed some missing flags and bugs in the security creation.