fixed conversion warnings
fixed memory leaks
fixed memory leaks in a directory traversing code