Fixing bug, now using updated db object