Expenses again soared, when a massive Muslim army invaded the empire in 806, forcing Nikephoros I to pay a ransom of gold coins and a yearly tribute of gold coins. In order to impress the Caliph of Baghdad, Theophilos distributed 36,000 gold coins to the citizens of Baghdad, and in 838, he was forced to pay gold dinars to the Caliph. The Byzantine economic recovery in the early 9th century can be seen by the fact that Emperor Theophilos was able to leave 7,000,000 "nomismata"/31.5 tonnes of gold in the imperial treasury for his successor in 842. After Theophilos' death his wife Theodora II continued his successful policies and even increased the imperial reserves to 7,848,000 "nomismata."