Pull request 64 bit

Fixes some 64-bit compatibility issues.