Fix for bug 1047950 and bug 1047952