improve image tag parsing