Added better error handling. Made capture output foolproof(ish)

Fixed capture_test since I removed .body
Made graph_writer_tests better