Added check to avoid unnecessary mkdir requests