fix some functions, complete record checking