added a fix for using where nested