Fix some problems found by winapi_check.