fix wrong if closure