Fixed a bug in lengthSquared.