Patches for bugs #1635 and #1643, which should be released in 3.0.1.

Change-Id: I407e1cd8f2553227f4f65d9468c89390a7975dba