Fix template notifications and undefined index.