Fixing build errors and compiler warnings