better leaf size checking