fixed a lot of stupid bugs