How to detect errors in a model