use defer.returnValue instead of raising StopIteration