added to_h function to task context