fix bug that generates the index page multiple times