add a new function to get the last error (see #2)