Fixed bug of using StringReader wrongly.

Change the while loop condition on line 88 to while (true), checks if read() returns -1 for breaking condition
Fixed bug where read() character has not been casted