Updating a preprint when it is under review
In principle, anything that happens to the content of a paper before printing (ie, formal publication) should be reflected in the pre-print.  So yes, if you correct a bug while the paper is in review, or revise the paper for a new submission, then you should update the preprint.

However, some journals object to authors' posting post-copy-edited (or even post-refereed) revisions.  And posting a revision while a paper is under review could interfere with the reviewing process.  When in doubt, ask your editor.

Frequent updates may earn you a reputation for being sloppy, especially on a system like the ArXiv that publishes the preprint's revision history.  (Why didn't you fix those bugs before you uploaded the first time?)  But that's still better than leaving a buggy preprint out in the wild, thereby earning you a reputation for not even knowing (or caring) that you're sloppy.  The right answer, of course, is to debug your papers before you post them!