Bug fixed related to when function

When an array containing one single item ( one deferred ) was used as argument for the "when" function, the deferred was immediately returned as a resolve for itself, instead of the real solved value of that deferred. A small fixed for this situation was added into the code, and a test as well.