changed position of calculation of inSampleSize