Fix warning by casting long to int