fixed a few bugs, mostly random errors