fixes for bugs 783499 and 833877, other misc changes