better tests and some small fixes