fixed String.substring typo
count is increasing too much...loop on line 14