Added a fix for the scoping error with the db. Issue #279