Fixes for running under a security manager