Add test for error detection