bugfixes to multi-layer extraction