removed corrupted error handling code