Fix for issue http://hub.qgis.org/issues/10766