More parsing and fixing of syntax errors