Fixed a bug in BuildImageFactory.