Fix bugs to pass the second sample code.