avoid warning of comparision of integers of different signs
remove size_t cast