fix bug where Sample does not play

The provided Sample/ does not work because it causes the JS to crash due to `img_path` not being defined. 

Added an additional check for the missing parameter