Fix bug when viewing nested directories, closes #314