fix bug: lose data when restart

New: add commit() after add().