fixed flash issue in index script & template