Fixed logic in test and update script.