Fix #15 add validation to db.

Fix #15 add validation to db.