fixed sample/notes query logic