Fix 0ffb202 and reinstate changes from e739089.