fixing bugs for db rake tasks