improve image validate