#6: more post-refactoring fixes, added to small functions for basename and dirname