Fix Syntax and Reference errors