rewrite core update function