Major bug fix due to poorly coded back directory function