Fixed bug when resolving async sub dependecies
Refactored for better readablity and fixed async error when missing dependency