Fixed a race bug that I noticed in code-read