Fix entity record bug
Remove orig file
Remove unused code