fix logic bug in calling update