Fixed memory problem which was causing a copy of the internal image data to be made