better API for async mode and fix backward compatibility