Made a few tweaks to support compiling with gcc