fixed #21 wrong sql count syntax