Fixed a bug where an unresolved WinAPI error could result in an access violation