Fix build and syntax errors