fixed a whole bunch of bugs