make sure path is defined before passing it to leaflet