bug fix in my previous modification