fix and enhance security test