fixed db access in rake files