fixed a whole lot of stupid bugs