added very powerful error detection