Whole bunch of fixes