new function; some bug corrected