Revert "Use setElement"

This reverts commit a007dbfc6506c6b6e2f2020c397fdd9863c319d1.