Fixed call of resolve function to not fail  if angular.forEach passes the object as third argument in each iteration.
closes #20