improved 'onUpdate'