Fixing code so that few basic tests work