Fix: use size_t instead of int in several places