Promise bug fix (undefined callback)