Fixed bugs with EF