Rewrite history again, fix connection being closed after timeout