Resolved issue with hashes being re-used by adding a critical section