fixing an issue with angular not digesting promises