Fix a couble Database bugs.