onUpdate has to be called from annonymous function to be able to change it