On the problem of fault detection and residual generation