We consider a system with three possible states, good, defective and failed. Failures are detected as soon as they occur; the defective state, which is only revealed by inspection, does not prevent the system from fulfilling the function for which it was designed. We present a maintenance model consisting of periodic inspections to check the state of the system, in which inspections are subject to error. At a false positive inspection the system is unnecessarily replaced; at a false negative inspection a defect remains unrevealed with reliability implications for future operation. The model is illustrated with an example from the railways. In this context, we suppose that system lifetime is heterogeneous so that the time the system spends in the defective state is a random variable from a mixed distribution. We determine under what circumstances the cost of maintenance cannot be justified by its efficacy, and suggest that when there is the possibility that replacement is poorly executed (lifetime heterogeneity) the natural response to imperfect inspection of increasing the inspection frequency can be counter-productive.