What did the emperor do in response to so many defeats by the Europeans