Bug fixes

Fixed some bugs introduced with library changes.
Fixed a couple security syntax errors.