flgsel and flgmatwt accessable in function call