rebased the patch for bug 874061
landed patch for bug 874061