fix bug with multiple elements