Fix update function crash