FS#2111, improve security check
Merge pull request #177 from splitbrain/FS#2111

FS#2111, improve security check