fixing syntax, some functions broken due to wrong version's syntax.  will fix in another commit
a number of small fixes