added checking of image extension