Fixes bug when deleting cms templates