Fix for bug #2940