Fixes syntax errors and missing stream variable