Changed conditional jump from r[A] == 1 to r[A] != 0