This check is duplicated in the update() function.