fixing deadlock and bug in inmemory

have to do for others too using Offloading