switched to dirname()