added check for showing errors