removed all syntax errors except illegal patterns