fix a bug in .flatMap: exception thrown when resubscribing to stream (fix #29)