fix race condition in resetting data, fixes #506