Fix z-index-issue with popups

Fixes #303.

Please review.