this cast wouldn't be needed if we were using `ssize_t` instead of `int`