Fixed parsing problems in the first loop