fix wrong if check