fix some warnings

* remove unused variables
* fix warning caused by data type convertion