record last error