some old fixes and cleanup