fix race-condition in functional test