Handmade merge with http://jira.codehaus.org/browse/GEOS-6020