Various fixes from master (some only in my master PR)