Fix problem with permission in class static initializer

This fixes some problems that show up when running the test suite with the security manager enabled.