fix for when the page ajax reloads when popup opens