fixed a lot of problems