Fix bugs in display of elements