Merge pull request #505 from alex/system-error

Switch to using our own InternalError, instead of SystemError