address review comment and fix deprecated functions