added some code to generate errors for testing