Fix regression in chained_path() introduced in fb763b01879f6943bf8f601f37e03947ccbf7511. Includes regression test. #1184