change to keep the context on select_by_filename
control to not overlap calls to  select_by_filename function