Fix LONG_MAX to int conversion for 64bit systems to long int