Improves error logging