recursively resolve promises if needed