element sorting fix