Once you Multi threaded it you need to follow a guide for mutex locks otherwise your going to get a race condition..