changed mod to size_t