Fix for last token in query