Some minor improvements and fixes in tests