fix template fit width and height of window