fix query in case of empty string