Fix some compiler warnings and unused variables