fix non deterministic behaviour in test