Fixed wrong initialization of conditional clause in note query