WIN32 - added error handling