implement truncate and fstat better