Apply RxJava #1641 and #1651 manually

As per https://github.com/ReactiveX/RxJava/pull/1641 and https://github.com/ReactiveX/RxJava/pull/1651