Fix: check for directory not for file