Fix date in the loop and change links in database