erts: More fixes, mostly implementing sen_term