replace long to size_t or int
fix bugs on android