Fix compiler warnings, also fix sloppy directory-changing
Fix invalid read (thank you valgrind)
fix all memory leaks by means of a low-quality "GC"