#27 fix headers already sent errors, and a syntax error