Fixing flaky test and clean up