Fixed GCC compilation

Made some changes so GCC (used 4.7.2) compiles. There are still some
warnings. The ones produced by Hive Engine will be addressed in future
commits.