Fix a number of long-failing tests

Please merge this pull request.