fix empty element bug