Fix int overflow. It should be long instead of int.