Fixed a few bugs which prevented compilation on GCC.