Sometimes $paths is only a scalar. Check first before treating it as a
list.