fix before_save callback that updates attrs