fixed a whole heap of things