fix pattern for img download

to handle SI:7 agent
more scala way to handle async image download
Merge pull request #335 from tyrcho/fixes

New fixes from tyrcho