Deleting documents in sync gateway 1.3

Hi, we are using Sync Gateway 1.3.1 and I can no longer delete documents in the way I was deleting them in sync gateway 1.1.1. Our sync function has a simple check for deleting documents so that an admin can delete any document:

var isAdmin = function () {
        try {
            return true;
        } catch (error) {
            return false;

if (doc._deleted && oldDoc) {
        if (oldDoc._deleted) {
            throw ({
                        forbidden: "already deleted"
        if (isAdmin()) {

This code worked fine in sync gateway 1.1.1, but now in 1.3.1 it no longer works and it looks like the original statement is skipped and the rest of our sync gateway code is executed instead of the delete code. Our sync gateway logs show this when I try to delete a documnet as an admin user:

2017-03-20T14:45:18.460Z HTTP:  #1304396: DELETE /todos/<doc id>?rev=57-c58e02c5b2efe739144712a5cea205b3  (as <admin user id>)
2017-03-20T14:45:18.498Z Sync fn rejected: new=map[_id:<doc id> _rev:59-ab9b392f17de5bd056c5e003b876df0c _deleted:true]  old= --> 403 invalid document

Was there a change made to sync gateway in 1.3.1? The docs say that the sync function signature is still function(doc, oldDoc), and that is all we need for this code to work as we expect, but instead it is either saying that doc._deleted is not true, or that oldDoc does not exist.

Nevermind, this seems to be an issue with the document itself, it has a _rev and _new_rev field. Will open a new thread to ask about it.