Fixing Errors with database interface