bug fix in returned code