move update condition to correct location