added a bunch of fixes