fixed Entities, fixed session_write_close