fixed infinite loop
fixed an error in values
fixed error on if