Replace if with case (temp, will make perm if fix)