In Cobol, procedures can be programmed in ways that lead to unexpected behaviour and reduced portability. This behaviour is recognized as so-called 'mines': programming practices containing hidden dangers and requiring extreme caution. Cobol mines can be created intentionally or by a programming error, and can be tripped at an unforeseen moment. This leads to minefields in source code with unseen hazards, which complicate understanding and maintenance, and which can lead to costly breakdowns of business critical software systems. We discuss Cobol mines and the dangers that come with them, having implemented a mine detector for Cobol. Our detector was deployed in an industrial situation, and a number of minefields were found in production systems. By restructuring a complex legacy application, we argue that code restructuring can be used to combat minefields. Copyright © 2006 John Wiley & Sons, Ltd.