fixed 32-bit stamped ref stuff, have no idea whats going on with 64-bit