fixes a bunch of errors