more debug logging, fixed did_complete not set and other minor fixes