Fixes to lots of stuff