big set of changes to fix broken tests