update spaces of elements