Partial fix for directory detection