fixing bug in lockdown query