fixed Entity code