Fixed Thread Safety issue due to global "ep" pointer