added timeout so db_write will not hang in the case where external hosting goes down