fixes and tests