Fixed a bug in database module.