window size check and dialog shift added.