fix spec and code at chapter9