various fixes
fixes and tests