a tiny test exposing the problem - just set the umask to some specific value and, invoking the test, you'll see that it will have been reverted to '022'.