fix bug in dirty workaround of facets, remove 12 sonar issues