very important changes to clerk, missing additional where statements in some queries