Fixed 64 bit compilation warnings and errors

Fixed 64 bit compilation warnings and errors