stoi() out of range bug-fix