Fix #1 - throw error for leading zeroes

This also fixes some test cases which were broken and adds some new test
cases to verify that the errors are thrown as expected.