Fixed incorrect timestamps when inserting into db.