Fixed a few warnings and errors