fixes https://github.com/angular/angular.js/issues/8333