Fixed compile warnings about unused variables and signed/unsigned
mismatches