Fixed some compiler warnings and linker errors