More memory fix
Homogeneize extract to never return references.

Tests have been changed accordingly and complex case have
been added in proper module.