Counter wasn't being decremented resulting in infinite loop