Fix for directory check