minor improvement
registerShutdownFunction has been moved to OS script