add a -2 for . and .. as well as check malloc