Fix wrong length value passed to fd_write().