Fix for wrong elements index.