Fixed issue on windows where long wasn't large enough. Also fixed initialization bug