fixed some bugs with the integer conversion