improve prepare API and value API