Fixed clearing restrictions / applying template for application groups

Fixes #1202