Merged changes from the 4.2.x branch