Fix API and exception for current specs.
Merge pull request #1 from fossilet/master

Update API and add exception for current specs.