Fixed bugs on index template