Make parent path check more robust and use it when expanding parent dirs of new selections