casting signed integers to unsigned for correntness and no compiler
warinings