fixed a lot of dumb bugs