Fix prevElement setting.