Fixed incorrect results on Windows and Python<3.1