fix unsigned/signed compare warning
remove unused vars