bug fix wrong function