Fix timing issues with test