The best way to correct for flaws is to prevent them from occurring in the first place. In the case of spots simply make sure that you start with a clean imaging sensor. A high quality lens with a complex lens formula will eliminate Chromatic Aberration. A high quality lens with lens coatings, the use of a lens hood or changing your perspective will all mitigate Ghosting. Note that some of these flaws can be corrected in post processing.