syntax fixes and bug squashing