fixed terminate error