Fixed error on "onSuccess" callback being null or undefined.