A whole bunch of fixes