Fix duplicate entries in database updating timestamp