Fix path handling to detect type and size