Fixed thread safe bug.