Fixed some entity framework issues