Fixed a bug which caused the vec to which the image is saved in
saveToVec to have twice as much elements at vec[0].