to implement sys_exit