enhance thread safety