Some fixes found while investigating issues