Realized a possible race condition in memory writing logic.