conversion to signed int was throwing a rangerror