Some of that is more deliberate than others--I am tired of cutting stories slack for torture works and is therefore acceptable, regardless of when written, but an awful lot of older writers were reflecting the racism, sexism, and other prejudices that were all around them.