Fixed the security utility and added a couple tests for it