fix bug in top right and bottom right corner of frame