lots of fixes