Fix for bug #1240