Bugfixes for 64 bits