fixes mimetype
removes nested empty elements