"can't convert Array into String" in dirname