Fixed security directory references.
Fixed code to get unique references.