Add new tests

No new features, but small bug fixes, thanks to all the new tests.