Fixing tests with random functions