fixed encode for index template