fixes a bunch of stuff