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