fix several -Wsign-compare warnings