Vector clamping fixes

Thank you, @madmaxoft.