Updated patch for latest code changes