Fixed bug where criteria are not checked correctly