Fixed a few warnings (one very serious)

Fixed a few warnings (one very serious)