fixed bug on insert entity