completed patch for bug 827083. updated patch for bug 826798