merge from svn dev branch (rev 1242) and other cleanup