fixed syntax and function errors