Made the .then function not called when a promise failed