A whole load of fixes