fixes a lot of stuff