fixed a problem that the promises chain breaks if one or more repo is empty, use q.allsettleed() instead of q.all()