fix several small bugs, and also use em.adapter with direct open