fix model instance's id
fix a database bug. issue#12 no column None.
properly close files using with statement