Fixes crash, cleaned up for 64 bit