Fixed the bug, it had something to do with initEncode's setting the outside cards to be visible, this must have been left in the state on the server. Not really sure why this caused the problem because we only call initEncode via GET request and we use POST for all ajax requests.