added image format checks