added custom decode: https://gist.github.com/arq5x/5315739