Fix error in write to error logs