Rework patches and update for svn rev 1361