write to handler context where possible