Be proactive about checking for error codes.

I think that we should check error codes instead of just assuming that it works here...