fixing deadlock bug when resolving intedependent instances