Improvements for path selection in context paths (fixed #1089)