fixed INT_MAX bug

Fixed unexpected error for numbers more than INT_MAX