Various bits of fixes etc