template clean up
Fix bug when handling extra backet