Agreed upon fixes.

This pull request contains only non copyleft changes and changes that did not spark any discussion on if that is good or bad behavior for example the exit and fwrite changes.