Fork to fix https://github.com/angular/angular.js/issues/4138