Rework patches and update for svn rev 1390