Bunch of fixes ... argh I have no idea exactly what they were but they were important