Use systemerror where appropriate.

As discussed in #52. These are actually the only places where it was needed.