Bugfix to close popup on click