Fix GCC build and partially MSVC

And sync with master as a bonus ;)