path to img corrected. script is not elegant, but can be cleaned later