optimization for stableLocation did not work due to miscalculated length of elements.