Allow negative index for '#'
Fix some bugs
Improve error messages
Allow lcm of a range