fixed overflow bug on Windows