Fix some compatibility problems

Problems:
- There is no "count" method in Hash class in 1.8.5.
- There is no "each_char" method in String class in 1.8.5.
- String indexing in 1.8.5 returns ASCII code not sub-string.