use ssize_t instead of int