Fix for bug 906266 and bug 904913