minor refactor in order to have less races and eventually log them