fix -Wall warnings mainly remove unused variable use unsigned where needed