Fixed Crashes in Win64

Fixed bug which causes crashing in windows 64 bit