Fix bugs with top most pixel (border and flyout)

This should fix the bugs related to the top most pixel.