use correct path for is_dir check