override count function to work with postgres