Fixed a bug in determining DSTIMGID