Fixed typo that set instead of decrementing len