Better error reporting for promises. Only report in the case of unhandled errors.
removed out commented code
check that item[0] is defined before trying to release
corrected error code