Fix for writing simulation to a custom directory.