bug fix when killing an instance