Add support for proper termination.