some adjustments for stability. fixes for Count() for API.