UPDATE: Improve last error mechanism