Added a test for CheckFailedStament and corrected a bug