fixes image parse logic.