fix for bug 3583 by Mike Su