a bunch of fixes