Fix bug in retrieving of top view. The bug caused the popover not to show under some circumstances.