Fixes, cleanups, some GCC compatibility.