Further bug fixing/improvements for path selection (fixed #1088)