port of fixes from master and two more