add err() method to find last error
note changes