Fixed error handling on Windows environment.