 			if promiseOrValue instanceof Ext.ClassManager.get( 'Deft.util.Promise' ) or promiseOrValue instanceof Ext.ClassManager.get( 'Deft.util.Deferred' )
 				return promiseOrValue.then( callbacks )
 			else
-				return Ext.create( 'Deft.util.Deferred' ).resolve( promiseOrValue ).then( callbacks )
+				deferred = Ext.create( 'Deft.util.Deferred' )
+				deferred.resolve( promiseOrValue )
+				return deferred.then( callbacks )
 		
 		###*
 		Returns a new {@link Deft.util.Promise} that will only resolve once all the specified `promisesOrValues` have resolved.
 		The resolution value will be an Array containing the resolution value of each of the `promisesOrValues`.
 		###
 		all: ( promisesOrValues, callbacks ) ->
-			results = new Array[ promisesOrValues.length ]
+			results = new Array( promisesOrValues.length )
 			promise = @reduce( promisesOrValues, @reduceIntoArray, results )
 			
 			return @when( promise, callbacks )

		###
		reduce: ( promisesOrValues, reduceFunction, initialValue ) ->
			# Wrap the reduce function with one that handles promises and then delegates to it.
			reduceArguments = [
				( previousValueOrPromise, currentValueOrPromise, currentIndex ) ->
					return @when( previousValueOrPromise, ( previousValue ) ->
						return @when( currentValueOrPromise, ( currentValue ) ->
							return reduceFunction( previousValue, currentValue, currentIndex, promisesOrValues )
						)
					)

			while index < length
				# Skip holes
				if index of array
					reduced = reduceFunction( reduced, array[ index ], index, array )
				index++
			
			return reduced
