add conditional wait