Fixed bugs in stringToInt function.