fix seg fault if connector at the end