fix some tests and do some cleanup