fix img wrong write