tests and small fixes