Changes to recolocate the popup correctly