removed warning comparing signed with unsigned by casting to size_t