Fixed BD-40: error when COUNT is used with WHERE filter