Add more tests, fixed multi entities handling