more fixes and refinements