query modification for retrieving the objects