check if path.base & path.name exists before assignment, fixes #21, #22