applying role (permission template) is really slow - bugfix #660