Fixed bug in main template