Fix a bug in str_to_int