Global value of fdev is now correctly reset using on.exit