changed wait method api