Improve Thread Safety. not tested