Generating N htmls but there is a little bug