Error handling modified