directory class bug fixes and unit tests