enhanced and fixed directory handling once more again