Various fixes for GCC and POSIX.