update test code and change to onafterupdate