Fixed a bug in converting img types