Various fixes on popups

Closes #451
Closes #412