update Yashar's code (bug fix)