Fixes to the insertion sort procedure

Code comes from
http://www.opensource.apple.com/source/Libc/Libc-997.90.3/stdlib/FreeBSD/qsort.c
In some instances for particular lists the procedure would
unnecessaryily loop resulting in extremely slow sorts.