add waitChange function