some improvements
fix an extreme edge case