better framing and bug fix on writer