Fixed all the stuff that needed manual fixing after rebase from master.