updated to support 64bit and 32 bit properly