-1 replaced by dec in flipxxx make things work