whole bunch of fixes