Fix bug concerning concurrent access