Made dependency loading more robust