need to fix writeach, add in  place allocate for writes as well