Fix error logging for tasks