improves error logging