FIX: return the same error in all cases that dir does not exist