A number of bug and regression fixes from 5.3.2 and 5.4