Fix issue with ply_query