properly write response