Fixed bug where customQuery was never added

logic in 'if' statement was the wrong way around