Fix sql queries variables replacement.