Casting from size_t to int in order to fix falied compilation