Fix methods to detect window size