bug fixes with angular $q