fix wrong if statement