merged 64-bit changes from Andrewpk:master