use long instead of ssize_t