fix extent bug and tests