add some utils and minor updates.