fix extend nesting. Closes #22