added rob's patch
count working version withDb