Auto increment id field and fixed bug. Issue #135