Fixed problem when creating criteria.