Fixing small bug in prepareQuery

!empty gives the wrong answer if fromJSON returns TRUE