fixed a bunch of problems