window size check added