Developers use configuration options to tailor systems to different platforms. This configurability gives rise to an exponential configuration space and traditional tools (e.g., gcc) check only one configuration at a time. As a result, developers introduce configuration-related issues (i.e., bad smells and faults) that appear only when we select certain configuration options. By interviewing 40 developers and performing a survey with 202 developers, we find that configuration-related issues are harder to detect and more critical than issues that appear in all configurations. Furthermore, we propose a strategy to detect configuration-related issues and an approach to improve code quality (remove bad smells in preprocessor directives using a catalogue of refactorings). We found 131 faults and 500 bad smells in 40 real configurable systems, including Apache and libssh, ranging from 2.6 KLOC to 1.5 MLOC.