Modified error-raising code