bug fix, test improved