Fix serializePaths with multiple dynamic segments