Cast to int to avoid x64 warnings