Fix deadlock in future context