double function bug fix