[TO_STAGE] Fix for bug 1007582 and bug 1008517