Fixing entity bugs