Riak Fixes

Copy of #1408 from @ZaidM rebased to `master`