address PR review comments
relax thread containment
add packages & multi-source test cases
fix merge errors