add a mutex around subscribe