Don't call db functions outside of subroutines
Merge branch 'copy' into gb_master