Fixed bug entity relation & cleaning rep