Used size_t instead of long in a few instances of reinterpret_cast