added image size check