FIX: directory; memory leaks