wasnt testing for valid image correctly