Fix bug in security service