fixed bug with image download and thumbnail creation, images truncated due to no loop with buffer.