Some debug message perhaps needs modification since `src` can be "" or None.
And I like this commit because I also did some modification in my local autotest on this function, it will be convenient for users:)