small fixes, some new tests