Fixing flaky tests.
Merge pull request #512 from dziemid/fixing_flaky_test

Fixing flaky tests.