Fix bug with last.  More debugging.  Write stream end.