Code for bug #48.