Bunch of fixes

I think so, it's in the commit message.