Fixes for two core bugs

https://github.com/couchbase/couchbase-lite-java-core/issues/128
https://github.com/couchbase/couchbase-lite-java-core/issues/129