improved before_save