Fixed issue where Count with Conditional inside would generate invalid sql.