Fixed wrong calls to record_error_code. Fixes #54.