switching on globbing extension needs to be outside of the if