Patches to fix template syncing and cleanup.