Fix and clean up tests