fix bugs in img attachment from url