fixing home page bug with each loop