fix img manipulation bug