fix for part of the query replace