Updated safety fix and optimizations in submodules.