Conversion of str to int give 0 if str does not contain number.
Off by one error when removing elements.