Fixed some problems with embedded element handling