Replace use of to_int with to_i

It looks like to_int was being used a few places and wasn't available, this is related to issue #1111. I put a test in to cover this in a round about way on String, again a reason I think there needs to be C tests so these things can be tested directly.