more tests, small bug fixes