added simulation termination detect