fixed $elem bug