Fix accessing vector out of its boundaries preventing possible crash, this is for 3.4 branch and master.<br>