decrementing wrong variable