Fix TypeError if path is an empty string