update function from load.c