some fixes and tests