fixed a bunch of 64bit issues
updated build script