Prevent errors when last_element is a number.
Merge pull request #24 from Ignigena/master

Prevent errors when last_element is a number.