working on writeBites().