fix some 64bit problems, other impls