added file writing on hook post