add code for checking error rule