Bug fix in setValue infinite loop