move popup size definition before popup template creation