Some fixes from the 2.x branch.
version 1.78