Numerous fixes, see CHANGES.txt for full list