updates to beforesave