bug fix in newly introduced function