fix bug where top end does not connect properly