small fixes and tests